from todo_api_project.base.myBase import Tools

class reg_model(Tools):
    # 定义路径
    path = '/user/register'
    # 发送注册请求
    def reg_action(self,usr,pwd,cpwd,email,check='1234'):
        mydata = {
            "username": usr,
            "password": pwd,
            "cpassword": cpwd,
            "checkcode": check,
            "email": email
        }
        try:
            self.log('正在发送注册请求')
            res = self.huihua.post(url=self.hosturl+self.path, data=mydata)
            self.log(f'响应报文为{res.json()}')
            return res.json()
        except Exception as e:
            self.log(f'注册请求出错了，出错原因未{e}，请求报文为{mydata}，请求地址为{self.hosturl+self.path}')
#
# import requests
# s = requests.session()
# reg = reg_model(huihua=s)
# msg = reg.reg_action(usr='18912310003',pwd='admin112345678909876',cpwd='admin112345678909876',email='nier33eaaa@qq.com')
# print( msg )
